import Vue from "vue";
import VueRouter from "vue-router"

const Home= () =>import("../views/home/Home");
const Classify= () =>import("../views/classify/Classify");
const Cart= () =>import("../views/cart/Cart");
const Profile= () =>import("../views/profile/Profile");
const Detail = () => import("../views/detail/Detail")

// 1、安装插件
Vue.use(VueRouter)

// 2、创建路由对象
const routes=[
  {
    path: '/',
    redirect: '/Home'
  },
  {
    path: '/Home',
    component: Home
  },
  {
    path: '/Classify',
    component: Classify
  },
  {
    path: '/Cart',
    component: Cart
  },
  {
    path: '/Profile',
    component: Profile
  },
  {
    path: '/Detail/:iid',
    component: Detail
  }
]

const router = new VueRouter({
  //配置对应的映射关系
  routes,
  mode: "history"
})

// 3、导出路由
export default router
